
////#include <stdio.h>
////#include <string.h>
////#include "../Misc/misc.h"
////#include "../Misc/DEHT.h"
////
////
////
////int cryptHashToTable(const unsigned char * x, int inputLength, int numOfEntries) {
////	LONG_INDEX_PROJ hashResult = pseudo_random_function(x, inputLength, (LONG_INDEX_PROJ)0x1100220033004400);
////	return (hashResult % 65536) % numOfEntries;
////
////}
////
////int cryptHashTo64bit(const unsigned char * x, int inputLength, unsigned char * result) {
////	LONG_INDEX_PROJ hashResult = pseudo_random_function(x, inputLength, (LONG_INDEX_PROJ)0x0123012301230123);
////	memcpy( result, (unsigned char *)&hashResult, sizeof(LONG_INDEX_PROJ) );
////	return sizeof(LONG_INDEX_PROJ);
////	
////}
////
////
//////int binaryHashMaker(const unsigned char *key,int keyLength,int tableLength){
//////	int i, result = 0;
//////	for (i = 0; i < keyLength; i++){
//////		result += *key;
//////		key++;
//////	}
//////	result = result % tableLength;
//////	return result;
//////}
////
//////int cryptHashTo64bit (const unsigned char *key,int keyLength, unsigned char *buff){
//////	memcpy(buff, key, 8);
//////	return 8;
//////}
////
////void test1(void) {
////	int i = 0;
////	DEHT *ht;
////			int err;
////	if ((ht = create_empty_DEHT("yael10", cryptHashToTable, cryptHashTo64bit, "SHA1", 10, 5, 8)) == NULL) {
////		printf("failed create\n");
////		return;
////	}
////	//if (read_DEHT_pointers_table(ht) == DEHT_STATUS_FAIL) {
////	//	printf("read_DEHT failed\n");
////	//	return;
////	//}
////	//if (calc_DEHT_last_block_per_bucket(ht) == DEHT_STATUS_FAIL) {
////	//	printf("calc_DEHT failed\n");
////	//	return;
////	//}
////	//if (write_DEHT_pointers_table(ht) == DEHT_STATUS_FAIL) {
////	//	printf("calc_DEHT failed\n");
////	//	return;
////	//}
////	
////	for (i = 0; i < 100; i++) {
////		char mypassword[14];
////		unsigned char hashed[16];
////		sprintf(mypassword, "myPassword%d", i);
////		MD5BasicHash((unsigned char *) mypassword, strlen(mypassword), hashed);
////		err = add_DEHT(ht, hashed, 16, (unsigned char *) mypassword, strlen(mypassword));
////		switch(err){
////		case DEHT_STATUS_FAIL: {
////			printf("add failed for %s\n", mypassword);
////			break;
////		}
////		default: {
////			printf("added - %s\n", mypassword);
////			break;
////		}
////		}
////	}
////
////	for (i = 0; i < 100; i++) {
////		char mypassword[14];
////		unsigned char hashed[16];
////		char hashedInHexa[33];
////		sprintf(mypassword, "myPassword%d", i);
////		MD5BasicHash((unsigned char *) mypassword, strlen(mypassword), hashed);
////		binary2hexa(hashed, 16, hashedInHexa, 33);
////		err = query_DEHT(ht, hashed, 16, (unsigned char *) mypassword, 14);
////		switch (err) {
////		case DEHT_STATUS_FAIL: {
////			printf("error!\n");
////			break;
////		}
////		case DEHT_STATUS_NOT_NEEDED: {
////			printf("key - %s - not found!\n", hashedInHexa);
////			break;
////		}
////		default: {
////			printf("password for %s: %s\n", hashedInHexa, mypassword);
////			break;
////		}
////		}
////
////	}
////	if (write_DEHT_pointers_table(ht) == DEHT_STATUS_FAIL){
////		printf("write_DEHT failed!");
////	}
////	lock_DEHT_files(ht);
////	printf("done!");
////
////	/*ht = load_DEHT_from_files("yael8", binaryHashMaker, cryptHashTo64bit);
////	 read_DEHT_pointers_table(ht);
////	 calc_DEHT_last_block_per_bucket(ht);*/
////
////}
////
////void test2() {
////	DEHT *ht;
////	int i = 0;
////	int num_of_keys = 10000;
////	int hash_size = SHA1_OUTPUT_LENGTH_IN_BYTES;
////	if ((ht = create_empty_DEHT("golan8", cryptHashToTable, cryptHashTo64bit, "SHA1", 20, 20, 8)) == NULL) {
////		printf("failed create\n");
////		return;
////	}
////	//read_DEHT_pointers_table(ht);
////	//calc_DEHT_last_block_per_bucket(ht);
////	for (i = 0; i < num_of_keys; i++) {
////		char mypassword[25];
////		unsigned char hashed[SHA1_OUTPUT_LENGTH_IN_BYTES];
////		switch (i % 5) {
////		case 0:
////			sprintf(mypassword, "myPassword%d", i);
////			break;
////		case 1:
////			sprintf(mypassword, "%dPassword%d", i, i + 1);
////			break;
////		case 2:
////			sprintf(mypassword, "%d", i);
////			break;
////		case 3:
////			sprintf(mypassword, "my other password");
////			break;
////		case 4:
////			sprintf(mypassword, "shnaboob_%d", i);
////			break;
////		}
////		SHA1BasicHash((unsigned char *) mypassword, strlen(mypassword), hashed);
////		add_DEHT(ht, hashed, hash_size, (unsigned char *) mypassword, strlen(mypassword));
////		//insert_uniquely_DEHT(ht, hashed, hash_size, (unsigned char *) mypassword, strlen(mypassword));
////	}
////
////	for (i = 0; i < num_of_keys; i++) {
////		char mypassword[25];
////		unsigned char hashed[SHA1_OUTPUT_LENGTH_IN_BYTES];
////		char hashedInHexa[33];
////		int err;
////		switch (i % 5) {
////		case 0:
////			sprintf(mypassword, "myPassword%d", i);
////			break;
////		case 1:
////			sprintf(mypassword, "%dPassword%d", i, i + 1);
////			break;
////		case 2:
////			sprintf(mypassword, "%d", i);
////			break;
////		case 3:
////			sprintf(mypassword, "my other password");
////			break;
////		case 4:
////			sprintf(mypassword, "shnaboob_%d", i);
////			break;
////		}
////
////		SHA1BasicHash((unsigned char *) mypassword, strlen(mypassword), hashed);
////		binary2hexa(hashed, 16, hashedInHexa, 33);
////		err = query_DEHT(ht, hashed, hash_size, (unsigned char *) mypassword, 25);
////		switch (err) {
////		case DEHT_STATUS_FAIL: {
////			printf("error!\n");
////			break;
////		}
////		case DEHT_STATUS_NOT_NEEDED: {
////			printf("not found!\n");
////			break;
////		}
////		default: {
////			printf("password for %s: %s\n", hashedInHexa, mypassword);
////			break;
////		}
////		}
////
////	}
////	write_DEHT_pointers_table(ht);
////	lock_DEHT_files(ht);
////	printf("done!");
////
////}
//<<<<<<< .mine
////
////void test3() {
////	DEHT *ht = load_DEHT_from_files("golan8", cryptHashToTable, cryptHashTo64bit);
////	char *pass1 = "my other password";
////	char *pass2 = "eran!!!";
////	char *pass3 = "shnaboob_199";
////	unsigned char hashed1[SHA1_OUTPUT_LENGTH_IN_BYTES];
////	unsigned char hashed2[SHA1_OUTPUT_LENGTH_IN_BYTES];
////	unsigned char hashed3[SHA1_OUTPUT_LENGTH_IN_BYTES];
////	unsigned char data1[17 * 20 + 1];
////	unsigned char data11[17 * 18 + 1];
////	unsigned char data111[15 * 10 + 1];
////	unsigned char *point1[21];
////	unsigned char *point11[21];
////	unsigned char *point111[6];
////	unsigned char data2[8 * 2 + 1];
////	unsigned char *point2[3];
////	unsigned char data3[12 * 2 + 1];
////	unsigned char *point3[2];
////	int length = 0;
////
////	SHA1BasicHash((unsigned char *) pass1, strlen(pass1), hashed1);
////	SHA1BasicHash((unsigned char *) pass2, strlen(pass2), hashed2);
////	SHA1BasicHash((unsigned char *) pass3, strlen(pass3), hashed3);
////
////	read_DEHT_pointers_table(ht);
////	calc_DEHT_last_block_per_bucket(ht);
////
////	if ((length = mult_query_DEHT(ht, hashed1, SHA1_OUTPUT_LENGTH_IN_BYTES, data1, 17 * 20 + 1, point1, 21)) == DEHT_STATUS_FAIL)
////		printf("error1!");
////	else {
////		int i;
////		printf("my other password res1:\n");
////		for (i = 0; i < length; i++) {
////			unsigned char brara[100] = { 0 };
////			memcpy(brara, point1[i], point1[i + 1] - point1[i]);
////			printf("%d: %s\n", i, brara);
////		}
////	}
////
////	if ((length = mult_query_DEHT(ht, hashed1, SHA1_OUTPUT_LENGTH_IN_BYTES, data11, 17 * 18 + 1, point11, 21)) == DEHT_STATUS_FAIL)
////		printf("error11!");
////	else {
////		int i;
////		printf("my other password res11:\n");
////		//for (i = 0; i < length && point11[i] != 0 && point11[i+1] != 0; i++) {
////		for (i = 0; i < length; i++) {
////			unsigned char brara[100] = { 0 };
////			memcpy(brara, point11[i], point11[i + 1] - point11[i]);
////			printf("%d: %s\n", i, brara);
////		}
////	}
////
////	if ((length = mult_query_DEHT(ht, hashed1, SHA1_OUTPUT_LENGTH_IN_BYTES, data111, 15 * 10 + 1, point111, 6)) == DEHT_STATUS_FAIL)
////		printf("error111!");
////	else {
////		int i;
////		printf("my other password res111:\n");
////		//for (i = 0; i < 6 && point111[i] != 0 && point111[i+1] != 0; i++) {
////		for (i = 0; i < length; i++) {
////			unsigned char brara[100] = { 0 };
////			memcpy(brara, point111[i], point111[i + 1] - point111[i]);
////			printf("%d: %s\n", i, brara);
////		}
////	}
////
////	if ((length = mult_query_DEHT(ht, hashed2, SHA1_OUTPUT_LENGTH_IN_BYTES, data2, 8 * 2 + 1, point2, 3)) == DEHT_STATUS_FAIL)
////		printf("error2!");
////	else {
////		int i;
////		printf("res1111:\n");
////		for (i = 0; i < length; i++) {
////			unsigned char brara[100] = { 0 };
////			memcpy(brara, point2[i], point2[i + 1] - point2[i]);
////			printf("%d: %s\n", i, brara);
////		}
////	}
////
////	if ((length = mult_query_DEHT(ht, hashed3, SHA1_OUTPUT_LENGTH_IN_BYTES, data3, 12 * 2 + 1, point3, 2)) == DEHT_STATUS_FAIL)
////		printf("error3!");
////	else {
////		int i;
////		printf("res V:\n");
////		for (i = 0; i < length; i++) {
////			unsigned char brara[100] = { 0 };
////			memcpy(brara, point3[i], point3[i + 1] - point3[i]);
////			printf("%d: %s\n", i, brara);
////		}
////	}
////
////	printf("done!");
////}
////
////int main(int argc, char *argv[]) {
////	test1();
////	test2();
////	test3(); /*needs file for test2*/
////	getchar();
////	return 0;
////}
//=======
//
//void test1(void) {
//	int i = 0;
//	DEHT *ht;
//			int err;
//	if ((ht = create_empty_DEHT("yael10", cryptHashToTable, cryptHashTo64bit, "MD5", 10, 5, 8)) == NULL) {
//		printf("failed create\n");
//		return;

//#include <stdio.h>
//#include <string.h>
//#include "../Misc/misc.h"
//#include "../Misc/DEHT.h"
//
//
//
//int cryptHashToTable(const unsigned char * x, int inputLength, int numOfEntries) {
//	LONG_INDEX_PROJ hashResult = pseudo_random_function(x, inputLength, (LONG_INDEX_PROJ)0x1100220033004400);
//	return (hashResult % 65536) % numOfEntries;
//
//}
//
//int cryptHashTo64bit(const unsigned char * x, int inputLength, unsigned char * result) {
//	LONG_INDEX_PROJ hashResult = pseudo_random_function(x, inputLength, (LONG_INDEX_PROJ)0x0123012301230123);
//	memcpy( result, (unsigned char *)&hashResult, sizeof(LONG_INDEX_PROJ) );
//	return sizeof(LONG_INDEX_PROJ);
//	
//}
//
//
////int binaryHashMaker(const unsigned char *key,int keyLength,int tableLength){
////	int i, result = 0;
////	for (i = 0; i < keyLength; i++){
////		result += *key;
////		key++;
////	}
////	result = result % tableLength;
////	return result;
////}
//
////int cryptHashTo64bit (const unsigned char *key,int keyLength, unsigned char *buff){
////	memcpy(buff, key, 8);
////	return 8;
////}
//
//void test1(void) {
//	int i = 0;
//	DEHT *ht;
//			int err;
//	if ((ht = create_empty_DEHT("yael10", cryptHashToTable, cryptHashTo64bit, "MD5", 10, 5, 8)) == NULL) {
//		printf("failed create\n");
//		return;

//	}

//	if (read_DEHT_pointers_table(ht) == DEHT_STATUS_FAIL) {
//		printf("read_DEHT failed\n");
//		return;
//	}
//	if (calc_DEHT_last_block_per_bucket(ht) == DEHT_STATUS_FAIL) {
//		printf("calc_DEHT failed\n");
//		return;
//	}
//	//if (write_DEHT_pointers_table(ht) == DEHT_STATUS_FAIL) {
//	//	printf("calc_DEHT failed\n");
//	//	return;
//	//}
//	
//	for (i = 0; i < 100; i++) {
//		char mypassword[14];
//		unsigned char hashed[16];
//		sprintf(mypassword, "myPassword%d", i);
//		MD5BasicHash((unsigned char *) mypassword, strlen(mypassword), hashed);
//		//err = add_DEHT(ht, hashed, 16, (unsigned char *) mypassword, strlen(mypassword));
//		err = insert_uniquely_DEHT(ht, hashed, 16, (unsigned char *) mypassword, strlen(mypassword));
//		switch(err){
//		case DEHT_STATUS_FAIL: {
//			printf("add failed for %s\n", mypassword);
//			break;
//		}
//		default: {
//			printf("added - %s\n", mypassword);
//			break;
//		}
//		}
//	}
//
//	for (i = 0; i < 100; i++) {
//		char mypassword[14];
//		unsigned char hashed[16];
//		char hashedInHexa[33];
//		sprintf(mypassword, "myPassword%d", i);
//		MD5BasicHash((unsigned char *) mypassword, strlen(mypassword), hashed);
//		binary2hexa(hashed, 16, hashedInHexa, 33);
//		err = query_DEHT(ht, hashed, 16, (unsigned char *) mypassword, 14);
//		switch (err) {
//		case DEHT_STATUS_FAIL: {
//			printf("error!\n");
//			break;
//		}
//		case DEHT_STATUS_NOT_NEEDED: {
//			printf("key - %s - not found!\n", hashedInHexa);
//			break;
//		}
//		default: {
//			printf("password for %s: %s\n", hashedInHexa, mypassword);
//			break;
//		}
//		}
//
//	}
//	if (write_DEHT_pointers_table(ht) == DEHT_STATUS_FAIL){
//		printf("write_DEHT failed!");
//	}
//	lock_DEHT_files(ht);
//	printf("done!");
//
//	/*ht = load_DEHT_from_files("yael8", binaryHashMaker, cryptHashTo64bit);
//	 read_DEHT_pointers_table(ht);
//	 calc_DEHT_last_block_per_bucket(ht);*/
//
////}
////
////void test2() {
////	DEHT *ht;
////	int i = 0;
////	int num_of_keys = 10000;
////	int hash_size = SHA1_OUTPUT_LENGTH_IN_BYTES;
////	if ((ht = create_empty_DEHT("golan8", cryptHashToTable, cryptHashTo64bit, "SHA1", 20, 20, 8)) == NULL) {
////		printf("failed create\n");
////		return;
////	}
////	//read_DEHT_pointers_table(ht);
////	//calc_DEHT_last_block_per_bucket(ht);
////	for (i = 0; i < num_of_keys; i++) {
////		char mypassword[25];
////		unsigned char hashed[SHA1_OUTPUT_LENGTH_IN_BYTES];
////		switch (i % 5) {
////		case 0:
////			sprintf(mypassword, "myPassword%d", i);
////			break;
////		case 1:
////			sprintf(mypassword, "%dPassword%d", i, i + 1);
////			break;
////		case 2:
////			sprintf(mypassword, "%d", i);
////			break;
////		case 3:
////			sprintf(mypassword, "my other password");
////			break;
////		case 4:
////			sprintf(mypassword, "shnaboob_%d", i);
////			break;
////		}
////		SHA1BasicHash((unsigned char *) mypassword, strlen(mypassword), hashed);
////		//add_DEHT(ht, hashed, hash_size, (unsigned char *) mypassword, strlen(mypassword));
////		insert_uniquely_DEHT(ht, hashed, hash_size, (unsigned char *) mypassword, strlen(mypassword));
////	}
////
////	for (i = 0; i < num_of_keys; i++) {
////		char mypassword[25];
////		unsigned char hashed[SHA1_OUTPUT_LENGTH_IN_BYTES];
////		char hashedInHexa[33];
////		int err;
////		switch (i % 5) {
////		case 0:
////			sprintf(mypassword, "myPassword%d", i);
////			break;
////		case 1:
////			sprintf(mypassword, "%dPassword%d", i, i + 1);
////			break;
////		case 2:
////			sprintf(mypassword, "%d", i);
////			break;
////		case 3:
////			sprintf(mypassword, "my other password");
////			break;
////		case 4:
////			sprintf(mypassword, "shnaboob_%d", i);
////			break;
////		}
////
////		SHA1BasicHash((unsigned char *) mypassword, strlen(mypassword), hashed);
////		binary2hexa(hashed, 16, hashedInHexa, 33);
////		err = query_DEHT(ht, hashed, hash_size, (unsigned char *) mypassword, 25);
////		switch (err) {
////		case DEHT_STATUS_FAIL: {
////			printf("error!\n");
////			break;
////		}
////		case DEHT_STATUS_NOT_NEEDED: {
////			printf("not found!\n");
////			break;
////		}
////		default: {
////			printf("password for %s: %s\n", hashedInHexa, mypassword);
////			break;
////		}
////		}
////
////	}
////	write_DEHT_pointers_table(ht);
////	lock_DEHT_files(ht);
////	printf("done!");
////
////}
////
////void test3() {
////	DEHT *ht = load_DEHT_from_files("golan8", cryptHashToTable, cryptHashTo64bit);
////	char *pass1 = "my other password";
////	char *pass2 = "eran!!!";
////	char *pass3 = "shnaboob_199";
////	unsigned char hashed1[SHA1_OUTPUT_LENGTH_IN_BYTES];
////	unsigned char hashed2[SHA1_OUTPUT_LENGTH_IN_BYTES];
////	unsigned char hashed3[SHA1_OUTPUT_LENGTH_IN_BYTES];
////	unsigned char data1[17 * 20 + 1];
////	unsigned char data11[17 * 18 + 1];
////	unsigned char data111[15 * 10 + 1];
////	unsigned char *point1[21];
////	unsigned char *point11[21];
////	unsigned char *point111[6];
////	unsigned char data2[8 * 2 + 1];
////	unsigned char *point2[3];
////	unsigned char data3[12 * 2 + 1];
////	unsigned char *point3[2];
////	int length = 0;
////
////	SHA1BasicHash((unsigned char *) pass1, strlen(pass1), hashed1);
////	SHA1BasicHash((unsigned char *) pass2, strlen(pass2), hashed2);
////	SHA1BasicHash((unsigned char *) pass3, strlen(pass3), hashed3);
////
////	read_DEHT_pointers_table(ht);
////	calc_DEHT_last_block_per_bucket(ht);
////
////	if ((length = mult_query_DEHT(ht, hashed1, SHA1_OUTPUT_LENGTH_IN_BYTES, data1, 17 * 20 + 1, point1, 21)) == DEHT_STATUS_FAIL)
////		printf("error1!");
////	else {
////		int i;
////		printf("my other password res1:\n");
////		for (i = 0; i < length; i++) {
////			unsigned char brara[100] = { 0 };
////			memcpy(brara, point1[i], point1[i + 1] - point1[i]);
////			printf("%d: %s\n", i, brara);
////		}
////	}
////
////	if ((length = mult_query_DEHT(ht, hashed1, SHA1_OUTPUT_LENGTH_IN_BYTES, data11, 17 * 18 + 1, point11, 21)) == DEHT_STATUS_FAIL)
////		printf("error11!");
////	else {
////		int i;
////		printf("my other password res11:\n");
////		//for (i = 0; i < length && point11[i] != 0 && point11[i+1] != 0; i++) {
////		for (i = 0; i < length; i++) {
////			unsigned char brara[100] = { 0 };
////			memcpy(brara, point11[i], point11[i + 1] - point11[i]);
////			printf("%d: %s\n", i, brara);
////		}
////	}
////
////	if ((length = mult_query_DEHT(ht, hashed1, SHA1_OUTPUT_LENGTH_IN_BYTES, data111, 15 * 10 + 1, point111, 6)) == DEHT_STATUS_FAIL)
////		printf("error111!");
////	else {
////		int i;
////		printf("my other password res111:\n");
////		//for (i = 0; i < 6 && point111[i] != 0 && point111[i+1] != 0; i++) {
////		for (i = 0; i < length; i++) {
////			unsigned char brara[100] = { 0 };
////			memcpy(brara, point111[i], point111[i + 1] - point111[i]);
////			printf("%d: %s\n", i, brara);
////		}
////	}
////
////	if ((length = mult_query_DEHT(ht, hashed2, SHA1_OUTPUT_LENGTH_IN_BYTES, data2, 8 * 2 + 1, point2, 3)) == DEHT_STATUS_FAIL)
////		printf("error2!");
////	else {
////		int i;
////		printf("res1111:\n");
////		for (i = 0; i < length; i++) {
////			unsigned char brara[100] = { 0 };
////			memcpy(brara, point2[i], point2[i + 1] - point2[i]);
////			printf("%d: %s\n", i, brara);
////		}
////	}
////
////	if ((length = mult_query_DEHT(ht, hashed3, SHA1_OUTPUT_LENGTH_IN_BYTES, data3, 12 * 2 + 1, point3, 2)) == DEHT_STATUS_FAIL)
////		printf("error3!");
////	else {
////		int i;
////		printf("res V:\n");
////		for (i = 0; i < length; i++) {
////			unsigned char brara[100] = { 0 };
////			memcpy(brara, point3[i], point3[i + 1] - point3[i]);
////			printf("%d: %s\n", i, brara);
////		}
////	}
////
////	printf("done!");
////}
////
////int main(int argc, char *argv[]) {
////	test1();
////	test2();
////	test3(); /*needs file for test2*/
////	getchar();
////	return 0;
////}

//	if (read_DEHT_pointers_table(ht) == DEHT_STATUS_FAIL) {
//		printf("read_DEHT failed\n");
//		return;
//	}
//	if (calc_DEHT_last_block_per_bucket(ht) == DEHT_STATUS_FAIL) {
//		printf("calc_DEHT failed\n");
//		return;
//	}
//	//if (write_DEHT_pointers_table(ht) == DEHT_STATUS_FAIL) {
//	//	printf("calc_DEHT failed\n");
//	//	return;
//	//}
//	
//	for (i = 0; i < 100; i++) {
//		char mypassword[14];
//		unsigned char hashed[16];
//		sprintf(mypassword, "myPassword%d", i);
//		MD5BasicHash((unsigned char *) mypassword, strlen(mypassword), hashed);
//		//err = add_DEHT(ht, hashed, 16, (unsigned char *) mypassword, strlen(mypassword));
//		err = insert_uniquely_DEHT(ht, hashed, 16, (unsigned char *) mypassword, strlen(mypassword));
//		switch(err){
//		case DEHT_STATUS_FAIL: {
//			printf("add failed for %s\n", mypassword);
//			break;
//		}
//		default: {
//			printf("added - %s\n", mypassword);
//			break;
//		}
//		}
//	}
//
//	for (i = 0; i < 100; i++) {
//		char mypassword[14];
//		unsigned char hashed[16];
//		char hashedInHexa[33];
//		sprintf(mypassword, "myPassword%d", i);
//		MD5BasicHash((unsigned char *) mypassword, strlen(mypassword), hashed);
//		binary2hexa(hashed, 16, hashedInHexa, 33);
//		err = query_DEHT(ht, hashed, 16, (unsigned char *) mypassword, 14);
//		switch (err) {
//		case DEHT_STATUS_FAIL: {
//			printf("error!\n");
//			break;
//		}
//		case DEHT_STATUS_NOT_NEEDED: {
//			printf("key - %s - not found!\n", hashedInHexa);
//			break;
//		}
//		default: {
//			printf("password for %s: %s\n", hashedInHexa, mypassword);
//			break;
//		}
//		}
//
//	}
//	if (write_DEHT_pointers_table(ht) == DEHT_STATUS_FAIL){
//		printf("write_DEHT failed!");
//	}
//	lock_DEHT_files(ht);
//	printf("done!");
//
//	/*ht = load_DEHT_from_files("yael8", binaryHashMaker, cryptHashTo64bit);
//	 read_DEHT_pointers_table(ht);
//	 calc_DEHT_last_block_per_bucket(ht);*/
//
//}
//
//void test2() {
//	DEHT *ht;
//	int i = 0;
//	int num_of_keys = 10000;
//	int hash_size = SHA1_OUTPUT_LENGTH_IN_BYTES;
//	if ((ht = create_empty_DEHT("golan8", cryptHashToTable, cryptHashTo64bit, "SHA1", 20, 20, 8)) == NULL) {
//		printf("failed create\n");
//		return;
//	}
//	//read_DEHT_pointers_table(ht);
//	//calc_DEHT_last_block_per_bucket(ht);
//	for (i = 0; i < num_of_keys; i++) {
//		char mypassword[25];
//		unsigned char hashed[SHA1_OUTPUT_LENGTH_IN_BYTES];
//		switch (i % 5) {
//		case 0:
//			sprintf(mypassword, "myPassword%d", i);
//			break;
//		case 1:
//			sprintf(mypassword, "%dPassword%d", i, i + 1);
//			break;
//		case 2:
//			sprintf(mypassword, "%d", i);
//			break;
//		case 3:
//			sprintf(mypassword, "my other password");
//			break;
//		case 4:
//			sprintf(mypassword, "shnaboob_%d", i);
//			break;
//		}
//		SHA1BasicHash((unsigned char *) mypassword, strlen(mypassword), hashed);
//		//add_DEHT(ht, hashed, hash_size, (unsigned char *) mypassword, strlen(mypassword));
//		insert_uniquely_DEHT(ht, hashed, hash_size, (unsigned char *) mypassword, strlen(mypassword));
//	}
//
//	for (i = 0; i < num_of_keys; i++) {
//		char mypassword[25];
//		unsigned char hashed[SHA1_OUTPUT_LENGTH_IN_BYTES];
//		char hashedInHexa[33];
//		int err;
//		switch (i % 5) {
//		case 0:
//			sprintf(mypassword, "myPassword%d", i);
//			break;
//		case 1:
//			sprintf(mypassword, "%dPassword%d", i, i + 1);
//			break;
//		case 2:
//			sprintf(mypassword, "%d", i);
//			break;
//		case 3:
//			sprintf(mypassword, "my other password");
//			break;
//		case 4:
//			sprintf(mypassword, "shnaboob_%d", i);
//			break;
//		}
//
//		SHA1BasicHash((unsigned char *) mypassword, strlen(mypassword), hashed);
//		binary2hexa(hashed, 16, hashedInHexa, 33);
//		err = query_DEHT(ht, hashed, hash_size, (unsigned char *) mypassword, 25);
//		switch (err) {
//		case DEHT_STATUS_FAIL: {
//			printf("error!\n");
//			break;
//		}
//		case DEHT_STATUS_NOT_NEEDED: {
//			printf("not found!\n");
//			break;
//		}
//		default: {
//			printf("password for %s: %s\n", hashedInHexa, mypassword);
//			break;
//		}
//		}
//
//	}
//	write_DEHT_pointers_table(ht);
//	lock_DEHT_files(ht);
//	printf("done!");
//
//}
//
//void test3() {
//	DEHT *ht = load_DEHT_from_files("golan8", cryptHashToTable, cryptHashTo64bit);
//	char *pass1 = "my other password";
//	char *pass2 = "eran!!!";
//	char *pass3 = "shnaboob_199";
//	unsigned char hashed1[SHA1_OUTPUT_LENGTH_IN_BYTES];
//	unsigned char hashed2[SHA1_OUTPUT_LENGTH_IN_BYTES];
//	unsigned char hashed3[SHA1_OUTPUT_LENGTH_IN_BYTES];
//	unsigned char data1[17 * 20 + 1];
//	unsigned char data11[17 * 18 + 1];
//	unsigned char data111[15 * 10 + 1];
//	unsigned char *point1[21];
//	unsigned char *point11[21];
//	unsigned char *point111[6];
//	unsigned char data2[8 * 2 + 1];
//	unsigned char *point2[3];
//	unsigned char data3[12 * 2 + 1];
//	unsigned char *point3[2];
//	int length = 0;
//
//	SHA1BasicHash((unsigned char *) pass1, strlen(pass1), hashed1);
//	SHA1BasicHash((unsigned char *) pass2, strlen(pass2), hashed2);
//	SHA1BasicHash((unsigned char *) pass3, strlen(pass3), hashed3);
//
//	read_DEHT_pointers_table(ht);
//	calc_DEHT_last_block_per_bucket(ht);
//
//	if ((length = mult_query_DEHT(ht, hashed1, SHA1_OUTPUT_LENGTH_IN_BYTES, data1, 17 * 20 + 1, point1, 21)) == DEHT_STATUS_FAIL)
//		printf("error1!");
//	else {
//		int i;
//		printf("my other password res1:\n");
//		for (i = 0; i < length; i++) {
//			unsigned char brara[100] = { 0 };
//			memcpy(brara, point1[i], point1[i + 1] - point1[i]);
//			printf("%d: %s\n", i, brara);
//		}
//	}
//
//	if ((length = mult_query_DEHT(ht, hashed1, SHA1_OUTPUT_LENGTH_IN_BYTES, data11, 17 * 18 + 1, point11, 21)) == DEHT_STATUS_FAIL)
//		printf("error11!");
//	else {
//		int i;
//		printf("my other password res11:\n");
//		//for (i = 0; i < length && point11[i] != 0 && point11[i+1] != 0; i++) {
//		for (i = 0; i < length; i++) {
//			unsigned char brara[100] = { 0 };
//			memcpy(brara, point11[i], point11[i + 1] - point11[i]);
//			printf("%d: %s\n", i, brara);
//		}
//	}
//
//	if ((length = mult_query_DEHT(ht, hashed1, SHA1_OUTPUT_LENGTH_IN_BYTES, data111, 15 * 10 + 1, point111, 6)) == DEHT_STATUS_FAIL)
//		printf("error111!");
//	else {
//		int i;
//		printf("my other password res111:\n");
//		//for (i = 0; i < 6 && point111[i] != 0 && point111[i+1] != 0; i++) {
//		for (i = 0; i < length; i++) {
//			unsigned char brara[100] = { 0 };
//			memcpy(brara, point111[i], point111[i + 1] - point111[i]);
//			printf("%d: %s\n", i, brara);
//		}
//	}
//
//	if ((length = mult_query_DEHT(ht, hashed2, SHA1_OUTPUT_LENGTH_IN_BYTES, data2, 8 * 2 + 1, point2, 3)) == DEHT_STATUS_FAIL)
//		printf("error2!");
//	else {
//		int i;
//		printf("res1111:\n");
//		for (i = 0; i < length; i++) {
//			unsigned char brara[100] = { 0 };
//			memcpy(brara, point2[i], point2[i + 1] - point2[i]);
//			printf("%d: %s\n", i, brara);
//		}
//	}
//
//	if ((length = mult_query_DEHT(ht, hashed3, SHA1_OUTPUT_LENGTH_IN_BYTES, data3, 12 * 2 + 1, point3, 2)) == DEHT_STATUS_FAIL)
//		printf("error3!");
//	else {
//		int i;
//		printf("res V:\n");
//		for (i = 0; i < length; i++) {
//			unsigned char brara[100] = { 0 };
//			memcpy(brara, point3[i], point3[i + 1] - point3[i]);
//			printf("%d: %s\n", i, brara);
//		}
//	}
//
//	printf("done!");
//}
//
//int main(int argc, char *argv[]) {
//	test1();
//	test2();
//	test3(); /*needs file for test2*/
//	getchar();
//	return 0;
//}

